package com.shop.loan.controller;

import com.shop.loan.model.common.ResResult;
import com.shop.loan.model.vo.UserReportVo;
import com.shop.loan.service.MachineRuleService;
import com.shop.loan.service.UserReportService;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.erupt.core.annotation.EruptRouter;
import xyz.erupt.core.constant.EruptRestPath;

import javax.annotation.Resource;


@RestController
@RequestMapping(EruptRestPath.ERUPT_API + "/userReport")
public class UserReportController {

    @Resource
    UserReportService userReportService;

    @Resource
    MachineRuleService machineRuleService;

//    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN, authIndex = 1)
//    @PostMapping("/get")
//    public ResResult get(@Ignore UserReportVo userReportVo) {
//        return userReportService.getUserReport(userReportVo, true);
//    }
//
//    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN, authIndex = 1)
//    @PostMapping("/machine/get")
//    public ResResult machineGet(@Ignore UserReportVo userReportVo) {
//        return machineRuleService.get(userReportVo.getOrderId());
//    }
//
//    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN, authIndex = 1)
//    @PostMapping("/getByAdmin")
//    public ResResult getByAdmin(@Ignore UserReport userReport) {
//        return userReportService.getUserReportByAdmin(userReport);
//    }

    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN)
    @PostMapping("/get")
    public ResResult get(@Ignore UserReportVo userReportVo) {
        return userReportService.getUserReportByAdmin(userReportVo, true);
    }


    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN)
    @PostMapping("/machine/get")
    public ResResult machineGet(@Ignore UserReportVo userReportVo) {
        return machineRuleService.get(userReportVo.getUserId());
    }

}
